import time
from selenium import webdriver
from selenium.webdriver.common.by import By

from utils.get_filepath import get_logo_path

driver = webdriver.Chrome()
driver.maximize_window()
driver.get("https://sahitest.com/demo/php/fileUpload.htm")
time.sleep(2)
# 绝对路径
# driver.find_element(By.ID, 'file').send_keys(r"C:/Users/LiuZiMing/Desktop/x.jpg")
# 相对路径 在get_filepath.py
path = get_logo_path()
driver.find_element(By.ID, 'file').send_keys(r"{}".format(path))
time.sleep(2)
driver.find_element(By.NAME, 'submit').click()

time.sleep(3)
driver.close()
